<?php
namespace app\common\validate;

use think\Validate;

class GuestbookValidate extends Validate
{
    protected $rule =   [
        'title'  => 'require|max:25',
        'content'  => 'require',
        'phone'  => 'require|mobile',
        'email'  => 'require|email',
		'listorder' =>'require|number'
    ];
    
    protected $message  =   [
        'title.require' => '标题必须填写',
        'title.max'     => '标题最多不能超过25个字符',
		'content.require' => '内容必须填写',
		'phone.require' => '必须输入手机',
		'phone.mobile' => '手机格式不正确',
		'email.require' => '必须输入邮箱',
		'email.email' => '必须输入正确的邮箱格式',
		'listorder.number' => '必须输入数字',
		'listorder.number' => '必须输入数字'
    ];
    
    protected $scene = [
        'add'  =>  ['title','content','phone','email'],
        'edit'  =>  ['title','content'],
		'sort' => ['listorder']
    ];
}
